package net.butfly.bus.server.invoker;

import net.butfly.bus.server.invoker.impl.RemoteConfig;
import net.butfly.bus.server.invoker.impl.SpringConfig;

public class InvokerTypeFactory {
	private enum Type {
		ebox, spring
	}

	private static InvokerTypeFactory instance = new InvokerTypeFactory();

	public static InvokerTypeFactory getInstance() {
		return instance;
	}

	public boolean isEBox(String type) {
		return type != null && type.toUpperCase().equals(Type.ebox.toString().toUpperCase());
	}

	public boolean isSpring(String type) {
		return type != null && type.toUpperCase().equals(Type.spring.toString().toUpperCase());
	}

	public Object getPrototype(String type) {
		if (isEBox(type)) {
			return new RemoteConfig();
		}
		if (isSpring(type)) {
			return new SpringConfig();
		}
		return null;
	}
}
